﻿using System;
using System.Data;
using System.Collections;
using CE.Database;

/// <summary>
/// Summary description for TAAceResponseDB
/// </summary>
/// 
namespace CE.TravelInsurance
{
    public class TAAceResponseDB
    {
        public TAAceResponseDB()
        {
            //
            // TODO: Add constructor logic here
            //

        }

        public Int64 Insert(TAAceResponse _taaceresponse)
        {
            MyDatabase _db = new MyDatabase();
            Int64 _result = -1;
            string _spName = "sprocProviderAceResponseInsertSingleItem";

            SortedList _sPara = new SortedList();
            #region Parameter
            _sPara.Add("@AceResponseID", _taaceresponse.AceResponseId);
            _sPara.Add("@CETAInsID", _taaceresponse.CETAInsId);
            _sPara.Add("@CETAId", _taaceresponse.CETAId);
            _sPara.Add("@AceResponse", _taaceresponse.AceResponse);
            _sPara.Add("@RefCEUserId", _taaceresponse.RefCEUserid);
          
            #endregion
            _result = _db.ExecuteSP(_spName, _sPara);

            return _result;
        }


        private TAAceResponse FillDataRecord(DataTable myDataTable, int rowId)
        {
            TAAceResponse myTAAceResponse = new TAAceResponse();
            myTAAceResponse.AceResponseId = Convert.ToInt64(myDataTable.Rows[rowId]["AceResponseId"].ToString());
            myTAAceResponse.CETAInsId = Convert.ToInt64(myDataTable.Rows[rowId]["CETAInsId"].ToString());
            myTAAceResponse.CETAId = Convert.ToInt64(myDataTable.Rows[rowId]["CETAId"].ToString());
            myTAAceResponse.AceResponse = myDataTable.Rows[rowId]["AceResponse"].ToString();
            myTAAceResponse.RefCEUserid = Convert.ToInt64(myDataTable.Rows[rowId]["RefCEUserid"].ToString());

            return myTAAceResponse;
        }
    }
}